package nju.mscs.data.object;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

public class VipList implements Serializable{
	protected  ArrayList<VipConsumer> vipList = new  ArrayList<VipConsumer>();
	protected VipConsumer search(String id){
		for(VipConsumer v:vipList)
			if(v.getId().equals(id))
				return v;
		return null;
	}
	
	protected Iterator<VipConsumer> getIterator(){
		return vipList.iterator();
	}
	
	protected void add(String name,String id,boolean sex,int telephone,Date date) {
		vipList.add(new VipConsumer(name, id, sex,telephone,date));
	}
	
	protected boolean add(VipConsumer object) {
		synchronized(vipList){//网络线程
		return vipList.add(object);
		}
	}

	protected boolean delete(String id) {
		// TODO Auto-generated method stub
		synchronized(vipList){//网络线程
		return vipList.remove(search(id));
		}
	}
}
